package study.week05.gateway.filter;

import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.handler.codec.http.FullHttpResponse;

public class CustomRandomRefuseHttpFilter implements CustomHttpFilter {
    @Override
    public boolean inbound(FullHttpRequest fullRequest, ChannelHandlerContext ctx) {
        int random = (int)(Math.random()*5);
        if(random==0){
            return false;
        }else {
            System.out.println("inbound ======2");
            return true;
        }
    }

    @Override
    public boolean outbound(FullHttpResponse response) {
        int random = (int)(Math.random()*5);
        if(random==0){
            return false;
        }else {
            System.out.println("outbound ======2");
            return true;
        }
    }
}
